import { ADD_CONFIG, UPDATA_CONFIG } from '../actionTypes'

const INITCONFIG = {}

export default function config(state = INITCONFIG, action) {
  switch (action.type) {
    case ADD_CONFIG:
      state[action.key] = action.value;
    	return state
    case UPDATA_CONFIG:
    	var obj = {};
    	obj[action.key] = action.value;
    	state[action.key] = action.value;
    	return Object.assign({}, state, obj)
    default:
      	return state
  }
}